#ifndef _TIMER_CALLBACK_H_
#define _TIMER_CALLBACK_H_

#include <stdint.h>

#define MAX_TIMER_NUM 10

#define	GET_TICK(tick)	\
do {		\
    tick = system_time;	\
} while (tick != system_time)

extern uint32_t system_time;

typedef struct{
  uint32_t tick_temp;
  uint32_t tick_begin;
}TICK;
typedef void (*timer_callback_function)(void*);

typedef enum {
    TIMER_ENABLE,
    TIMER_DISABLE
}SoftTimerStatus;

typedef enum {
    TIMER_UNUSE,
    TIMER_INUSE
}SoftTimerUse;

typedef enum {
    /*��������һ��*/
    TIMER_CALL_IMMEDIATELY,
    /*�ȴ�ʱ�䵽ʱ����*/
    TIMER_CALL_WAIT
}SoftTimerMode;


typedef enum {
    TIMER_OK=0,
    TIMER_MALLOC_ERR=1,
    TIMER_PRARM_ERR=2,

}SoftTimerReturn;

typedef struct SSOFT_TIMER{

    timer_callback_function timerFunc;
    SoftTimerStatus sTimerStatus;
    uint32_t timerStartTime;
    uint32_t timerTime;
	uint8_t timerInUsing;
}ssoft_Timer;


void ssoft_TimerInit(void);
ssoft_Timer* ssoft_TimerCreate(timer_callback_function func,SoftTimerMode mode,uint32_t time);
SoftTimerReturn ssoft_TimerDelete(ssoft_Timer* timer);
void ssoft_TimerTask(void);


uint32_t getSystemTime(void);
void updateSystemTime(void);

void test_TimerInit(void);
#endif


